<?php
namespace app\advice\controller;

use think\Controller;
use think\Db;
use app\advice\model\AdviceModel;

class Apis extends Controller
{
    public function addAdvice($advice)
    {
        $advice['advice_ctime'] = date('Y-m-d H:i:s', time());
        $AdviceModel = new AdviceModel();
        $res = $AdviceModel->addAdvice($advice);
        return json($res);
    }

    public function delAdviceById($id)
    {
        $AdviceModel = new AdviceModel();
        $res = $AdviceModel->delAdvice($id);
        return json($res);
    }

    public function upAdviceById($advice)
    {
        $advice['advice_utime'] = date('Y-m-d H:i:s', time());
        $AdviceModel = new AdviceModel();
        $res = $AdviceModel->upAdvice($advice);
        return json($res);
    }

    public function getAllAdvice()
    {
        $AdviceModel = new AdviceModel();
        $res = $AdviceModel->getAdvice(null);
        return json($res);
    }

}
